import React from 'react';
import Loadable, { LoadingComponentProps } from 'react-loadable';

const MyLoadingCompoinent = (props: LoadingComponentProps) => {
    if (props.error) {
        //错误页面
        return <div>Error! <button onClick={props.retry}>Retry</button></div>;
    } else if (props.pastDelay) {
        //加载中
        return null;
    } else {
        return null;
    }
}


export default (loader: any, loading = MyLoadingCompoinent) => {
    return Loadable({
        loader,
        loading,
    })
}
